﻿<%@ Page Title="Admin" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Admin.aspx.cs" Inherits="Groep8.Admin.Admin" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<h2>Admin-Panel</h2>
<%= Message %>
    
<ajaxToolkit:Accordion   
    ID="Accordion1"   
    CssClass="accordion"  
    HeaderCssClass="accordionHeader"  
    HeaderSelectedCssClass="accordionHeaderSelected"  
    ContentCssClass="accordionContent"
    FadeTransitions="true"
    RequireOpenedPane="false"
    SelectedIndex="-1"
    runat="server"> 
<Panes>  
    <ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">  
        <Header>Add user</Header>  
        <Content> 
        <asp:CreateUserWizard runat="server" ID="RegisterUser" ViewStateMode="Disabled" OnCreatedUser="RegisterUser_CreatedUser">
            <LayoutTemplate>
                <asp:PlaceHolder runat="server" ID="wizardStepPlaceholder" />
                <asp:PlaceHolder runat="server" ID="navigationPlaceholder" />
            </LayoutTemplate>
            <WizardSteps>
                <asp:CreateUserWizardStep runat="server" ID="RegisterUserWizardStep">
                    <ContentTemplate>
                        <p class="message-info">
                            Passwords are required to be a minimum of <%: Membership.MinRequiredPasswordLength %> characters in length.
                        </p>

                        <p class="validation-summary-errors">
                            <asp:Literal runat="server" ID="ErrorMessage" />
                        </p>

                        <fieldset>
                            <legend>Registration Form</legend>
                            <ol>
                                <li>
                                    <asp:Label ID="Label1" runat="server" AssociatedControlID="UserName">User name</asp:Label>
                                    <asp:TextBox runat="server" ID="UserName" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="UserName"
                                        CssClass="field-validation-error" ErrorMessage="The user name field is required." />
                                </li>
                                <li>
                                    <asp:Label ID="Label2" runat="server" AssociatedControlID="Email">Email address</asp:Label>
                                    <asp:TextBox runat="server" ID="Email" TextMode="Email" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="Email"
                                        CssClass="field-validation-error" ErrorMessage="The email address field is required." />
                                </li>
                                <li>
                                    <asp:Label ID="Label3" runat="server" AssociatedControlID="Password">Password</asp:Label>
                                    <asp:TextBox runat="server" ID="Password" TextMode="Password" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="Password"
                                        CssClass="field-validation-error" ErrorMessage="The password field is required." />
                                </li>
                                <li>
                                    <asp:Label ID="Label4" runat="server" AssociatedControlID="ConfirmPassword">Confirm password</asp:Label>
                                    <asp:TextBox runat="server" ID="ConfirmPassword" TextMode="Password" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="ConfirmPassword"
                                         CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The confirm password field is required." />
                                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="Password" ControlToValidate="ConfirmPassword"
                                         CssClass="field-validation-error" Display="Dynamic" ErrorMessage="The password and confirmation password do not match." />
                                </li>
                            </ol>
                            <asp:Button ID="Button1" runat="server" CommandName="MoveNext" Text="Register" />
                        </fieldset>
                    </ContentTemplate>
                    <CustomNavigationTemplate />
                </asp:CreateUserWizardStep>
            </WizardSteps>
        </asp:CreateUserWizard>              
        </Content>  
    </ajaxToolkit:AccordionPane>  
    <ajaxToolkit:AccordionPane ID="AccordionPane2" runat="server">  
        <Header>Edit user</Header>  
        <Content>  
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" DataKeyNames="UserId" BorderStyle="Solid" BorderWidth="1px" CellPadding="4" ForeColor="#333333" GridLines="None">
                <rowstyle CssClass="" />
                <alternatingrowstyle CssClass="alternate" />
                <Columns>
                    <asp:HyperLinkField DataNavigateUrlFields="Username"
                        DataNavigateUrlFormatString="admin.aspx?action=edit&id={0}"
                        Text="Edit"/>
                    <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" ReadOnly="True" Visible="False" />
                    <asp:BoundField DataField="Username" HeaderText="Username" SortExpression="Username" />
                    <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                    <asp:BoundField DataField="Role" HeaderText="Role" ReadOnly="True" SortExpression="Role" />
                </Columns>
                <EditRowStyle BackColor="#2461BF" HorizontalAlign="Center"/>
                <FooterStyle BackColor="#3A8DC7" Font-Bold="True" ForeColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
                <HeaderStyle BackColor="#3A8DC7" Font-Bold="True" ForeColor="White" BorderStyle="Solid" BorderColor="Black" BorderWidth="1px" HorizontalAlign="Center"/>
                <PagerStyle BackColor="#3A8DC7"  Font-Bold="True" ForeColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
                <RowStyle BackColor="#EFF3FB" HorizontalAlign="Center"/>
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" HorizontalAlign="Center"/>
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>

            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" SelectCommand="SelectUsers" SelectCommandType="StoredProcedure">
            </asp:SqlDataSource>
        </Content>  
    </ajaxToolkit:AccordionPane>  
    <ajaxToolkit:AccordionPane ID="AccordionPane3" runat="server">  
        <Header>Delete user</Header>  
        <Content>  
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource2" DataKeyNames="UserId" BorderStyle="Solid" BorderWidth="1px" CellPadding="4" ForeColor="#333333" GridLines="None">
                <rowstyle CssClass="" />
                <alternatingrowstyle CssClass="alternate" />
                <Columns>
                    <asp:HyperLinkField DataNavigateUrlFields="Username"
                        DataNavigateUrlFormatString="admin.aspx?action=delete&id={0}"
                        Text="Delete"/>
                    <asp:BoundField DataField="UserId" HeaderText="UserId" SortExpression="UserId" ReadOnly="True" Visible="False" />
                    <asp:BoundField DataField="Username" HeaderText="Username" SortExpression="Username" />
                    <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                    <asp:BoundField DataField="Role" HeaderText="Role" ReadOnly="True" SortExpression="Role" />
                </Columns>
                <EditRowStyle BackColor="#2461BF" HorizontalAlign="Center"/>
                <FooterStyle BackColor="#3A8DC7" Font-Bold="True" ForeColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
                <HeaderStyle BackColor="#3A8DC7" Font-Bold="True" ForeColor="White" BorderStyle="Solid" BorderColor="Black" BorderWidth="1px" HorizontalAlign="Center"/>
                <PagerStyle BackColor="#3A8DC7"  Font-Bold="True" ForeColor="White" BorderStyle="Solid" BorderWidth="1px" HorizontalAlign="Center"/>
                <RowStyle BackColor="#EFF3FB" HorizontalAlign="Center"/>
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" HorizontalAlign="Center"/>
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>

            <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:DefaultConnection %>" SelectCommand="SelectUsers" SelectCommandType="StoredProcedure">
            </asp:SqlDataSource>
        </Content>  
    </ajaxToolkit:AccordionPane>  
</Panes>  
</ajaxToolkit:Accordion>
</asp:Content>